home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / Freeware / PerfectPaint / rexx / general / SavePng_Brush2.rx < prev    next >
Encoding:
Text File  |  2002-10-01  |  2.8 KB  |  166 lines

  1. /*  arexx Script 
  2.   SAVE Picture in PNG format
  3.   need 'PNGtool' in PerfectPaint:tools/  
  4. */
  5.  
  6.   options results
  7.   parse ARG Port b
  8.   ADDRESS value Port
  9.   pp_AvoidRefresh
  10.  
  11.   file=""
  12.   file2=""
  13.   option=0
  14.     compression=5
  15.     interlace=0
  16.     version=0
  17.  
  18.   if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/SavePng_Brush2') THEN DO
  19.     IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/SavePng_Brush2', "R") then DO
  20.       file = READLN('lfile')
  21.       option=READLN('lfile')
  22.             compression=READLN('lfile')
  23.             interlace=READLN('lfile')
  24.             version=READLN('lfile')
  25.       CALL CLOSE('lfile')
  26.       file2=""
  27.       do i=1 to LENGTH(file)
  28.         a=SUBSTR(file,i,1)
  29.         if a=" " then DO
  30.           a="*"
  31.         END
  32.         file2=file2||a
  33.       END
  34.       file=file2
  35.     END
  36.   END
  37.  
  38.   pp_showscreen
  39.  
  40.     pp_GetDepth
  41.     D=result
  42.  
  43.   pp_DialogInit 250 160 "*Save*Png*Brush*" 6
  44.     pp_String 0 50 12 150 16 "Name" 1 100 file
  45.  
  46.     n=LASTPOS('/',file)
  47.     if n=0 then DO
  48.       n=LASTPOS(':',file)
  49.       file=SUBSTR(file,1,n)
  50.     END
  51.     else DO     
  52.       file=SUBSTR(file,1,n)
  53.     END
  54.  
  55.     pp_Getfile 1 205 13 0 "Save*Png" 0 file
  56.  
  57.         IF D<24 then DO
  58.         pp_Cycle 2 100 32 100 16 "Transparency" 1 "No|Yes" option            
  59.         END
  60.         ELSE DO
  61.         pp_Cycle 2 95 32 130 16 "Transparency" 1 "No|Use*Current*Mask" option
  62.         END
  63.  
  64.       pp_Slider 3 100 52 100 16 "Compression" 1 0 9 compression
  65.  
  66.       pp_Cycle 4 100 72 100 16 "Interlaced" 1 "No|Yes" interlace
  67.  
  68.       pp_Cycle 5 100 102 110 16 "Version" 1 "68000|PPC*(WarpUp)" version            
  69.         
  70.         pp_Dialog 
  71.  
  72.   rc=result
  73.   if rc=0 then
  74.     do
  75.       pp_PermitRefresh
  76.       EXIT
  77.     end 
  78.  
  79.   pp_GetDialog 0
  80.   file=result
  81.  
  82.   pp_GetDialog 2
  83.   option=result
  84.  
  85.   pp_GetDialog 3
  86.   compression=result
  87.  
  88.   pp_GetDialog 4
  89.   interlace=result
  90.  
  91.   pp_GetDialog 5
  92.   version=result
  93.  
  94.   CALL SavePrefs('SavePng_Brush2',file,option,compression,interlace,version)
  95.   ADDRESS value Port
  96.  
  97.     pp_SavePrefs 0 1 100 0 0
  98.     AA0="T:pp_Picture.iff"
  99.     pp_bSave AA0 0 1
  100.  
  101.   IF option=0 then DO
  102.         AA=" T=-1 "
  103.     END
  104.   ELSE DO
  105.         IF D=24 then DO
  106.             AA1="T:pp_Stencil.stn"
  107.             pp_InvBrushStencil
  108.             pp_bmSave AA1
  109.             pp_InvBrushStencil
  110.             AA=" A="||AA1||" "
  111.         END
  112.         ELSE DO
  113.             AA=" T=0 "
  114.         END
  115.     END
  116.  
  117.     AI=""
  118.     IF interlace=1 then DO
  119.         AI=" Interlaced "
  120.     END
  121.  
  122.     AC=" C="||compression
  123.  
  124.   pp_asay 'Making*PNG*file|Please*wait*...'     
  125.  
  126.      address COMMAND    
  127.     if version=0 then do
  128.         'perfectpaint:tools/PNGtool '||AA0||' '||file||' '||AA||AI||AC
  129.     end
  130.     else do
  131.         'perfectpaint:tools/PNGtoolPPC '||AA0||' '||file||' '||AA||AI||AC
  132.     end
  133.  
  134.   'delete >nil: '||AA0
  135.   'delete >nil: '||AA1        
  136.  
  137.   ADDRESS value Port
  138.     pp_SaveIconFor file 0
  139.   pp_closeasay
  140.  
  141.   pp_PermitRefresh
  142.   EXIT    
  143.  
  144.  
  145.  
  146. SavePrefs: PROCEDURE
  147.   
  148.   Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  149.  
  150.   if EXISTS(Prefname) THEN DO
  151.     ADDRESS COMMAND
  152.     'delete >nil: '||Prefname
  153.   END
  154.  
  155.   IF OPEN('pfile',PrefName,'W') THEN DO
  156.  
  157.   do i=2 to ARG()
  158.     CALL WRITELN('pfile',ARG(i))
  159.   end
  160.  
  161.   CALL CLOSE('pfile')
  162.  
  163. RETURN  
  164.  
  165.  
  166.